﻿using UnityEngine;
using System.Collections.Generic;

namespace Dict.Blo
{
    public class DictUnionFightGateBlo
    {
        static public List<Dict.DataModel.TableUnionFightGate> GetAll()
        {
            return Dict.DictDataManager.Instance.tableUnionFightGateDao.CacheList;
        }

        static public Dict.DataModel.TableUnionFightGate GetUnionFightGateByID(string id)
        {
            return Dict.DictDataManager.Instance.tableUnionFightGateDao.GetById(id);
        }

        static public Vector3 GetPosition(string id)
        {
            var pos = GetUnionFightGateByID(id);
            var sss = pos.Position.Trim().Split(new char[1] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
            var x = float.Parse(sss[0]);
            var y = float.Parse(sss[1]);
            var z = float.Parse(sss[2]);

            return new Vector3(x, y, z);
        }

        static public string[] GetEffectNodePaths(string id)
        {
            string[] paths = null;
            var gate = GetUnionFightGateByID(id);
            if(!string.IsNullOrEmpty(gate.GateState))
            {
                var sss = gate.GateState.Trim().Split(new char[1] { ';' }, System.StringSplitOptions.RemoveEmptyEntries);
                paths = sss;
            }

            return paths;
        }
        
    }
}